import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Text;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.widgets.Canvas;


// TODO: Auto-generated Javadoc
/**
 * The Class PokemonHIstory.
 */
public class PokemonHIstory {

	/** The shell. */
	protected Shell shell;
	
	/** The text. */
	private Text text;

	/**
	 * Launch the application.
	 *
	 * @param args the arguments
	 */
	public static void main(String[] args) {
		try {
			PokemonHIstory window = new PokemonHIstory();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setSize(700, 500);
		shell.setText("SWT Application");
		
		Label lblPokemonHistory = new Label(shell, SWT.NONE);
		lblPokemonHistory.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblPokemonHistory.setFont(SWTResourceManager.getFont("Lucida Grande", 25, SWT.BOLD));
		lblPokemonHistory.setBounds(195, 10, 263, 30);
		lblPokemonHistory.setText("Pokemon History");
		
		ListViewer listViewer = new ListViewer(shell, SWT.BORDER | SWT.V_SCROLL);
		List list = listViewer.getList();
		list.setItems(new String[] {"Pokemon history will show here"});
		list.setBounds(82, 291, 430, 73);
		
		Label lblHistory = new Label(shell, SWT.NONE);
		lblHistory.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblHistory.setFont(SWTResourceManager.getFont("Lucida Grande", 15, SWT.NORMAL));
		lblHistory.setText("History");
		lblHistory.setBounds(272, 263, 92, 22);
		
		ProgressBar progressBar = new ProgressBar(shell, SWT.NONE);
		progressBar.setSelection(75);
		progressBar.setBounds(215, 84, 172, 14);
		
		StyledText styledText = new StyledText(shell, SWT.BORDER);
		styledText.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				
			}
		});
		styledText.setText("Pokemon Picture will show here");
		styledText.setBounds(215, 114, 172, 132);
		
		Button btnBack = new Button(shell, SWT.NONE);
		btnBack.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				Object window;
				shell.close();
				window = new Trainer();
				((Trainer)window).open();
			}
		});
		btnBack.setBounds(195, 405, 94, 30);
		btnBack.setText("Back");
		
		Button btnSignOut = new Button(shell, SWT.NONE);
		btnSignOut.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				Object window;
				shell.close();
				window = new Main();
				((Main)window).open();
			}
		});
		btnSignOut.setText("Sign out");
		btnSignOut.setBounds(307, 405, 94, 30);
		
		//adding background
		final Display display = Display.getDefault();
		Canvas canvas = new Canvas(shell, SWT.NONE);
		canvas.addPaintListener(new PaintListener() {
			public void paintControl(PaintEvent arg0) {
					 org.eclipse.swt.graphics.Image image = new org.eclipse.swt.graphics.Image(display, "/Users/kennyha/Desktop/Eclipse Workplace/pokemonBackground.png");
					 arg0.gc.drawImage(image, 10, 10);

				        image.dispose();
				
			}
		});
		canvas.setBounds(-14, -22, 714, 500);
		
		Combo combo = new Combo(canvas, SWT.NONE);
		combo.setBounds(44, 197, 110, 22);
		combo.setItems(new String[] {"Pikachu", "B", "C", "D", "E", "F", "G"});
		combo.select(0);
		
		Label lblSelectPokemon = new Label(canvas, SWT.NONE);
		lblSelectPokemon.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblSelectPokemon.setBounds(44, 177, 110, 14);
		lblSelectPokemon.setText("Select Pokemon");
		
		text = new Text(canvas, SWT.BORDER);
		text.setBounds(455, 198, 92, 19);
		
		Label lblCurrentTrent = new Label(canvas, SWT.NONE);
		lblCurrentTrent.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblCurrentTrent.setBounds(455, 177, 92, 14);
		lblCurrentTrent.setText("Current Trent");
		

	}
}
